package com.th.cash.th2.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

class MainScreenAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {

    private val mHomeFragment by lazy { HomeFragment.newInstance() }
    private val mOrderFragments by lazy { OrderFragment.newInstance() }
    private val mMineFragment by lazy { MineFragment.newInstance() }

    override fun getCount(): Int {
        return 3
    }

    override fun getItem(position: Int): Fragment {
        return when (position) {
            0 -> mHomeFragment
            1 -> mOrderFragments
            2 -> mMineFragment
            else -> mHomeFragment
        }
    }
}